package com.example.qrcode.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.qrcode.entity.CurrentData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
@DS("power-cloud")  // 只current_data查power_cloud_data
public interface CurrentDataMapper extends BaseMapper<CurrentData> {

    @Select("SELECT * FROM current_data WHERE device_identifier = #{deviceIdentifier} AND service_id IN ('analog', 'discrete')")
    List<CurrentData> getCurrentDataByDeviceIdentifier(@Param("deviceIdentifier") String deviceIdentifier);

    @Select("SELECT * FROM current_data WHERE device_identifier = #{deviceId}")
    List<CurrentData> getCurrentDataByDeviceId(@Param("deviceId") String deviceId);
}

